/**
 * 
 */
package user_client;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


/**
 * @author Pawel Rychly
 *
 */
public class NormalUserClient extends DataBaseClient {
	
	public NormalUserClient(Connection connection, String userName, String userPassword) {
		
		super(connection, userName, userPassword);
	}
	
	/**
	 * Borrows book from librarry
	 */
	public void borrowBook(){
		//TODO: definition of this method
	}
	
	/**
	 * Returns an object with User information.
	 */
	public void getUserData(){
		
	}
	
	public void changePassword(String oldPass, String newPass) throws SQLException{

		if (oldPass.equals(this.getPassword())) {
			Statement stmt = this.getConnection().createStatement();
			System.out.println(this.getUserName());
			stmt.executeQuery("alter user " + this.getUserName()
				+ " identified by " + newPass);
			stmt.close(); 
		} else {
			System.out.println(oldPass);
			System.out.println(this.getPassword());
		}
	}
	

}
